test: stop test_topics_filter_pulse_still_ticks flaking on interleaved pulse ticks - #148
Merged
Conversation
…d pulse ticks
The actor is configured with pulse 50, so it emits a filter.out tick frame
every 50ms. The test consumed the first tick, then appended "noise" and "ev"
and asserted recv order was exactly "noise" then "ev". On slow windows and
macos CI runners a second tick landed in the store ahead of "noise", so the
recv returned "filter.out" and the strict assert_eq failed. The actor is
correct: async ticks interleave with data frames and the order between them is
not guaranteed. The two asserts over-specified that order.
Force the interleave to make it deterministic: sleep 60ms (past one 50ms pulse
period) after the first tick and before appending, so a second tick is always
queued ahead of the data frames on any machine. Then tolerate ticks the same
way the loop already did: drain filter.out tick frames and assert only that
"noise" and "ev" arrive in append order and the actor's filter.out {seen: ev}
output arrives.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What flaked and why
test_topics_filter_pulse_still_ticksfailed on the windows and macos CI runners while passing on ubuntu and local Linux.The actor under test is configured with
pulse: 50, so it emits afilter.outframe withtick: trueevery 50ms. The test consumed the first tick, then appendednoiseandevand asserted the recv order was exactlynoisethenev:On a slow runner, more than 50ms passed between consuming the first tick and this recv, so a second pulse tick landed in the store ahead of
noiseand the strictassert_eq!(... "noise")gotfilter.outinstead. The actor is behaving correctly: async pulse ticks interleave with data frames, and the order between a tick and a data frame is not guaranteed. The loop further down already tolerated interleaved ticks; these two asserts did not.Deterministic repro
Sleep 60ms (past one 50ms pulse period) after consuming the first tick and before appending, so a second tick is always queued ahead of the data frames on any machine. With that in place the old strict asserts fail deterministically (
assertion left == right failed, left: "filter.out", right: "noise"), matching CI.The fix
Keep the forced interleave so the test genuinely exercises the tick-between-data-frames case going forward, and tolerate ticks the same way the loop already did: drain
filter.outtick frames, then assert only thatnoiseandevarrive in append order and the actor'sfilter.out {seen: ev}output arrives.Verification
cargo test: 189 + 12 + 8 passed, 0 failedprocessor::actor::testsmodule: 35 passedcargo fmt --checkandcargo clippy -- -D warnings: cleannu tests/test_xs_nu.nu: a pre-existing scru128 id-roundtrip failure reproduces on a clean checkout of this branch's base too, unrelated to this changecheck.shneeds Node >=22.12.0; the local Node is v18.19.1, so that step is gated by the environment (unrelated to this change)